let request_key = 'jd_cookies_all'
let request_key_single ='jd_cookies'
 console.log(`修改领取状态`);
 console.log($request.url);
let body = $response.body;
body = body.replaceAll('"status":"7"', '"status":"5"')
body = body.replaceAll('"status":"6"', '"status":"5"')
body = body.replaceAll('"status":"4"', '"status":"5"')
body = body.replaceAll('"status":"8"', '"status":"5"')
body = body.replaceAll('"status":"8"', '"status":"5"')
// body = body.replace('"beginTimeStr":"20:00"', '"beginTimeStr":"19:00"')
// body = body.replace('"beginTimeStr":"21:00"', '"beginTimeStr":"19:00"')
// body = body.replace('"beginTimeStr":"22:00"', '"beginTimeStr":"19:00"')
// body = body.replace('"beginTimeStr":"10:00"', '"beginTimeStr":"09:00"')

if( $request.url.includes("mall/active")){
    let request_value = $store.get(request_key);


    let  jdCookie = $request.headers.Cookie
    let jdCookies = jdCookie.split(';')
    let pt_key = ""
    let pt_pin = ""
    for (let j = 0; j < jdCookies.length; j++) {
        let  item =  jdCookies[j] 
        if(item.includes("pt_key")){
            pt_key = item
            console.log(item);
        }
        if(item.includes("pt_pin")){
            pt_pin = item
            console.log(item);
        }
    }
    let temp = pt_key + ";"+pt_pin+ ";"
    $store.set(request_key_single, temp)  
    if(!request_value||request_value==""){
        request_value = temp
    }else if(!request_value.includes(pt_pin)){
        request_value = request_value +"@" +temp
    }
    $store.set(request_key, request_value)  
}


$done({ body })